import { createApp } from 'vue'
import { createPinia } from 'pinia'
import router from './router'
import App from './App.vue'
import 'normalize.css'
import '@/assets/styles/common.less'
import MessagePlugin from '@/utils/messagePlugin'
import piniaPersistedState from "pinia-plugin-persistedstate";
import worker from './mocks/browser'
const app = createApp(App)
app.use(createPinia())
//配置 Pinia 状态持久化插件。
const pinia = createPinia();
pinia.use(piniaPersistedState);
app.use(pinia);
app.use(router)
app.use(MessagePlugin)
app.mount('#app')

// 判断当前是否是开发环境
if (process.env.NODE_ENV === "development") {
    // 动态导入 worker
    const worker = require("./mocks/browser").default;
    // 开启请求拦截成功
    worker.start({ onUnhandledRequest: "bypass", quiet: true });
  }


